//package com.demo.module.config.sharding;
//
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.demo.module.entity.User;
//import com.demo.module.service.UserService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import javax.sql.DataSource;
//import java.sql.Connection;
//import java.sql.SQLException;
//import java.time.LocalDateTime;
//import java.util.List;
//
//@Slf4j
//@Order(value = 1)
//@Component
//public class ShardingTablesLoadRunner implements CommandLineRunner {
//
//    @Resource
//    private UserService userService;
//
//    @Autowired
//    DataSource dataSource;
//
//    @Override
//    public void run(String... args) {
//
//        try {
//            Connection connection = dataSource.getConnection();
//            System.out.println(connection);
//        } catch (SQLException e) {
//            throw new RuntimeException(e);
//        }
//        // 读取已有分表，进行缓存
//        LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
////        queryWrapper.eq(User::getCreateTime, LocalDateTime.now()).last("limit 1");
//        List<User> list = userService.list(queryWrapper);
//
//        log.info(">>>>>>>>>> 【ShardingTablesLoadRunner】缓存已有分表成功 <<<<<<<<<<");
//    }
//}
